<#-- Map jdbc type to java type-->
<#function jdbc2java jdbcType>
	<#assign jdbcType = jdbcType?lower_case>
	<#if jdbcType?contains("char") || jdbcType == "varchar" || jdbcType == "longvarchar">
		<#return "String">
	<#elseif jdbcType?contains("numeric") || jdbcType?contains("decimal")>
		<#return "Float">
	<#elseif jdbcType?contains("bit")>
		<#return "Boolean">
	<#elseif jdbcType?contains("tinyint")>
		<#return "Byte">
	<#elseif jdbcType?contains("smallint")>
		<#return "Short">
	<#elseif jdbcType?contains("integer")>
		<#return "Integer">
	<#elseif jdbcType?contains("bigint")>
		<#return "Long">
	<#elseif jdbcType?contains("int")>
		<#return "Integer">
	<#elseif jdbcType?contains("real")>
		<#return "Float">
	<#elseif jdbcType?contains("float")>
		<#return "Double">
	<#elseif jdbcType?contains("binary") || jdbcType?contains("varbinary") || jdbcType?contains("longvarbinary")>
		<#return "byte[]">
	<#elseif jdbcType?contains("date")>
		<#return "Date">
	<#elseif jdbcType?contains("time")>
		<#return "Date">
	<#elseif jdbcType?contains("timestamp")>
		<#return "Date">
	<#elseif jdbcType?contains("datetime")>
		<#return "Date">
	<#else>
		<#return "int">
	</#if>
</#function>

<#-- Generate test data for orcale data type-->
<#function generateOracleData jdbcType, seed>
	<#assign jdbcType = jdbcType?lower_case>
	<#if jdbcType?contains("char") || jdbcType == "varchar" || jdbcType == "longvarchar">
		<#return '"X' + seed + '"'>
	<#elseif jdbcType == "numeric" || jdbcType == "decimal">
		<#return seed>
	<#elseif jdbcType == "bit">
		<#return seed>
	<#elseif jdbcType == "tinyint">
		<#return seed>
	<#elseif jdbcType == "smallint">
		<#return seed>
	<#elseif jdbcType == "int">
		<#return seed>
	<#elseif jdbcType == "integer">
		<#return seed>
	<#elseif jdbcType == "bigint">
		<#return seed>
	<#elseif jdbcType == "real">
		<#return seed>
	<#elseif jdbcType == "Float">
		<#return seed>
	<#elseif jdbcType == "binary" || jdbcType == "varbinary" || jdbcType == "longvarbinary">
		<#return "byte[]">
	<#elseif jdbcType == "datetime">
		<#return "to_date('" + .now?string["yyyy-MM-dd HH:mm:ss"] + "','yyyy-mm-dd hh24:mi:ss')">
	<#elseif jdbcType == "date">
		<#return "to_date('" + .now?string["yyyy-MM-dd HH:mm:ss"] + "','yyyy-mm-dd hh24:mi:ss')">
	<#elseif jdbcType == "time">
		<#return "to_date('" + .now?string["yyyy-MM-dd HH:mm:ss"] + "','yyyy-mm-dd hh24:mi:ss')">
	<#elseif jdbcType == "timestamp">
		<#return "to_date('" + .now?string["yyyy-MM-dd HH:mm:ss"] + "','yyyy-mm-dd hh24:mi:ss')">
	<#else>
		<#return 3.3>
	</#if>
</#function>

<#-- Generate test data for orcale data type-->
<#function generateOracleData4SQL jdbcType, seed>
	<#assign jdbcType = jdbcType?lower_case>
	<#if jdbcType?contains("char") || jdbcType == "varchar" || jdbcType == "longvarchar">
		<#return "'X" + seed + "'">
	<#else>
		<#return generateOracleData(jdbcType, seed)>
	</#if>
</#function>

<#-- Map jdbc type to oracle type-->
<#function jdbc2mssql jdbcType>
	<#if jdbcType?contains("datetime")>
		<#return "date">
	</#if>
	<#return jdbcType>
</#function>

<#function jdbc2oracle jdbcType>
	<#if jdbcType?contains("datetime")>
		<#return "date">
	<#elseif jdbcType?contains("tinyint")>
		<#return "int">
	</#if>
	<#return jdbcType>
</#function>

<#function getTypePackage javaType>
	<#assign javaType = javaType?lower_case>
	<#if javaType == "numeric" || javaType == "decimal">
		<#return "java.math.BigDecimal">
	<#elseif javaType == "date">
		<#return "java.util.Date">
	<#elseif javaType == "datetime">
		<#return "java.util.Date">
	<#elseif javaType == "time">
		<#return "java.util.Date">
	<#elseif javaType == "timestamp">
		<#return "java.util.Date">
	<#else>
		<#return "">
	</#if>
</#function>

<#function getHTML5type jdbcType>
	<#assign jdbcType = jdbcType?lower_case>
	<#if jdbcType?contains("char") || jdbcType == "varchar" || jdbcType == "longvarchar">
		<#return "text">
	<#elseif jdbcType == "numeric" || jdbcType == "decimal">
		<#return "number">
	<#elseif jdbcType == "bit">
		<#return "number">
	<#elseif jdbcType == "tinyint">
		<#return "number">
	<#elseif jdbcType == "smallint">
		<#return "number">
	<#elseif jdbcType == "int">
		<#return "number">
	<#elseif jdbcType == "integer">
		<#return "number">
	<#elseif jdbcType == "bigint">
		<#return "number">
	<#elseif jdbcType == "real">
		<#return "number">
	<#elseif jdbcType == "Float">
		<#return "number">
	<#elseif jdbcType == "binary" || jdbcType == "varbinary" || jdbcType == "longvarbinary">
		<#return "text">
	<#elseif jdbcType == "date" || jdbcType == "datetime">
		<#return "date">
	<#elseif jdbcType == "time">
		<#return "time">
	<#elseif jdbcType == "timestamp">
		<#return "datetime">
	<#else>
		<#return "text">
	</#if>
</#function>

<#-- 为Oracle处理日期数据插入 -->
<#function getValue4Oracle field>
	<#--
	<#if field.type?contains("date") || field.type?contains("time")>
		<#return "to_date(to_char(#" + field.name + "#, 'yyyy-MM-dd'), 'yyyy-MM-dd')">
	</#if>
	-->
	<#return "#" + field.name + "#">
</#function>